<?xml version='1.0' encoding='UTF-8' ?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	template="/pages/templates/template.xhtml">
	<ui:define name="metadata">
	</ui:define>
	<ui:define name="content">
		<h:form id="formListaEventos">
			<div>
				<div class="div-titulo-tela">
					<p:outputLabel styleClass="titulo-tela">Eventos</p:outputLabel>
					<br /> <br />
					<p:separator></p:separator>
					<div class="div-titulo-botoes">
						<p:commandButton value="Novo" actionListener="#{EventoListaBean.doNovo}" ></p:commandButton>
					</div>
				</div>
				<div>
					<div class="div-corpo-tela">
						<div class="div-mensagem">
							<p:messages id="messages" autoUpdate="true" closable="true" />
						</div>
						<p:dataTable id="dataTable" var="evento"
							emptyMessage="Nenhum evento cadastroado."
							value="#{EventoListaBean.eventos}">
							
							<p:column headerText="Título">
								<h:outputText value="#{evento.titulo} " />
							</p:column>

							<p:column headerText="Data">
								<h:outputText value="#{evento.dthEvento}" >
									<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="GMT-03:00" />
								</h:outputText>
							</p:column>
							
							<p:column headerText="Grupo" rendered="#{EventoListaBean.privado}">
								<h:outputText value="#{evento.grupoTrabalho.grupo}" />
							</p:column>
							
							<p:column style="width:4%">
							<p:commandButton id="btnDetalhes" icon="ui-icon-pencil"
										title="Editar" disabled="#{grupo.situacao == 11}"
										actionListener="#{EventoListaBean.visualizarEvento(evento.id)}">
									</p:commandButton>
									<p:commandButton id="btnCancelar" icon="ui-icon-close"
										title="Cancelar" update="dataTable" onclick="confirmation.show()">
										<f:setPropertyActionListener
											target="#{EventoListaBean.eventoRemove}" value="#{evento}"></f:setPropertyActionListener>
									</p:commandButton>
								</p:column>
						</p:dataTable>
					</div>
				</div>
			</div>
		</h:form>
		
		<p:confirmDialog id="confirmDialog"
			message="Realmente deseja cancelar este evento?"
			header="Convite" severity="alert" appendToBody="true"
			widgetVar="confirmation">
			<h:form id="formConfirm">
				<p:commandButton id="confirm" value="Sim"
					update=":formListaEventos:dataTable" oncomplete="confirmation.hide()"
					actionListener="#{EventoListaBean.cancelaEvento}" />
				<p:commandButton id="decline" value="Não"
					onclick="confirmation.hide()" type="button" />
			</h:form>
		</p:confirmDialog>
		
	</ui:define>
</ui:composition>

